package Actions;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import forms.degreecollection;

public class moredegreeAction extends Action {
	
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response){
		
		forms.degreeform a = (forms.degreeform) form;
		
		a.setCount("more");
		
		forms.degreecollection newDegree = new degreecollection(a.getStuState(),a.getSchool(),
												a.getDiscp(),a.getDmonth(),a.getDyear(),a.getGpa(),a.getTitle(),
												a.getFileName(), a.getMyFile(), a.getFileSize());
		a.updateCollection(newDegree);
		  
		String more = request.getParameter("more");
		request.getSession().setAttribute("degreeCollections", a.getDegrees());
				
		
		if(more.equals("Yes")){
			a.resetdiscp();
	    	return mapping.findForward("yes");
		}
		else{
	    	return mapping.findForward("no");
		}
	}
}